/**
 *******************************************************************************
 * @FileName  : pool_buf.h
 * @Author    : GaoQiu
 * @CreateDate: 2020-05-18
 * @Copyright : Copyright(C) GaoQiu
 *              All Rights Reserved.
 *******************************************************************************
 *
 * The information contained herein is confidential and proprietary property of
 * GaoQiu and is available under the terms of Commercial License Agreement
 * between GaoQiu and the licensee in separate contract or the terms described
 * here-in.
 *
 * This heading MUST NOT be removed from this file.
 *
 * Licensees are granted free, non-transferable use of the information in this
 * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
 *
 *******************************************************************************
 */
#ifndef POOL_BUF_H_
#define POOL_BUF_H_

#include "defs_types.h"

/*!   Pool describe structure */
typedef struct{
	uint16_t len;
	uint8_t  num;
}pool_desc_t;

/**
 * @brief:  Initialize the buffer pool.  This function should only be called once
 *          upon system initialization.
 * @param:  pDesc       Array of buffer pool descriptors.
 * @param:  numPools    Number of buffer pools.
 * @return: Amount of buffer pool size used or 0 for failures.
 */
uint32_t PoolBufInit(pool_desc_t *pDesc, uint8_t numPools);

/**
 * @brief:  allocate a buffer.
 * @param:  len    Length of buffer to allocate.
 * @return: Pointer to allocated buffer or null if allocation fails.
 */
void *PoolBufAlloc(uint16_t len);

/**
 * @brief:  free a buffer
 * @param:  pBuf    Buffer to free.
 * @return: none
 */
void PoolBufFree(void *pBuf);



#endif /* POOL_BUF_H_ */
